//
//  AccountEntity.m
//  WCN
//
//  Created by 杨鑫 on 15/6/6.
//  Copyright (c) 2015年 ShanghaiCize Trade And Business Co., Ltd. All rights reserved.
//

#import "AccountEntity.h"
//
#import "Account.h"
#import "NurseDetail.h"
#import "Nurse.h"

@implementation AccountEntity

- (instancetype)initWithAccount:(Account *)account
{
    self = [super init];
    if (self) {
        _stringId = account.stringId;
        _name = account.name;
        _sex = account.sex;
        _mobile = account.mobile;
        _mail = account.mail;
        _intro = account.intro;
        _birthday = account.birthday;
        _hospitalId = account.hospitalId;
        _hospitalName = account.hospitalName;
        _wardId = account.wardId;
        _wardName = account.wardName;
        _qrCode = account.qrCode;
    }
    return self;
}

- (void)updateWithNurseDetail:(NurseDetail *)nurse
{
    _stringId = nurse.stringId;
    _name = nurse.name;
    _sex = nurse.sex;
    _mobile = nurse.mobile;
    _mail = nurse.mail;
    _intro = nurse.intro;
    _birthday = nurse.birthday;
    _hospitalId = nurse.hospitalId;
    _wardId = nurse.wardId;
     _qrCode = nurse.qrCode;
}

- (void)updateWithNurse:(id )nurse
{
    _stringId = [nurse valueForKey:@"stringId"];
    _name = [nurse valueForKey:@"name"];
    _sex = [nurse valueForKey:@"sex"];
//    _name = nurse.name;
//    _sex = nurse.sex;
}

- (NSString *)sexStr
{
    if ([@"MALE" isEqualToString:self.sex]) {
        return @"男";
    } else {
        return @"女";
    }
}

-(id)copyWithZone:(NSZone *)zone
{
    AccountEntity *newAccount = [[[self class] allocWithZone:zone] init];
    
    newAccount.stringId = self.stringId;
    newAccount.name = self.name;
    newAccount.sex = self.sex;
    newAccount.mobile = self.mobile;
    newAccount.mail = self.mail;
    newAccount.intro = self.intro;
    newAccount.birthday = self.birthday;
    newAccount.hospitalId = self.hospitalId;
    newAccount.hospitalName = self.hospitalName;
    newAccount.wardId = self.wardId;
    newAccount.wardName = self.wardName;
    newAccount.qrCode = self.qrCode;
    return newAccount;
}

@end
